//
//  RankingCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "RankingCell.h"
#import "UIImageView+WebCache.h"
#import "NSString+CatOut.h"
#import "FitHeader.h"
@implementation RankingCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _downLabel = [[UILabel alloc]init];
        _midLabel = [[UILabel alloc]init];
        _midLabel.textColor = [UIColor grayColor];
        _midLabel.font = [UIFont systemFontOfSize:13 * FITWidth];
        _playButton = [BaseButton buttonWithType:UIButtonTypeSystem];
        _playImageView = [[UIImageView alloc]init];
        [self addSubview:_playButton];
        [self addSubview:_downLabel];
        [self addSubview:_midLabel];
        [self addSubview:_playImageView];
        
        self.label.textAlignment = 0;
    }
    return self;
}
-(void)layoutSubviews
{
    self.imageView.frame = CGRectMake(5 * FITWidth, 0, 90 * FITWidth, 90 * FITHeight);
    
    self.label.frame = CGRectMake(self.imageView.frame.origin.x + self.imageView.frame.size.width + 5 * FITWidth, self.imageView.frame.origin.y + 6 * FITHeight, 200 * FITWidth, 30 * FITHeight);
  
    _midLabel.frame = CGRectMake(self.label.frame.origin.x, self.label.frame.origin.y + self.label.frame.size.height + 5 * FITHeight, self.label.frame.size.width, 23 * FITHeight);
   
    _playImageView.frame = CGRectMake(_midLabel.frame.origin.x, _midLabel.frame.origin.y + _midLabel.frame.size.height + 5 * FITHeight, 15 * FITWidth, 15 * FITHeight);
    _playImageView.image =[UIImage imageNamed:@"pause@2x.png"];
    _downLabel.frame = CGRectMake(_playImageView.frame.origin.x + _playImageView.frame.size.width + 3 * FITWidth, _playImageView.frame.origin.y, _midLabel.frame.size.width, _playImageView.frame.size.height);
    _playButton.frame = CGRectMake(self.frame.size.width - 30 * FITWidth, _midLabel.frame.origin.y, 20 * FITWidth, 20 * FITHeight);
    [_playButton setImage:[UIImage imageNamed:@"pause@2x"] forState:UIControlStateNormal];
    
    
    _downLabel.textColor = [UIColor grayColor];
    _downLabel.font = [UIFont systemFontOfSize:13 * FITWidth];

}
-(void)setModel:(ZBTopRadioListModel *)model
{
   // [self.imageView sd_setImageWithURL:[NSURL URLWithString:model.radioCoverLarge]];
    
   
}
-(void)setDictionary:(NSDictionary *)dictionary
{
    self.label.text = [dictionary objectForKey:@"rname"];
    self.label.font = [UIFont systemFontOfSize:16 * FITWidth];
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:[dictionary objectForKey:@"radioCoverLarge"]] placeholderImage:[UIImage imageNamed:@""]];
    _midLabel.text = [NSString stringWithFormat:@"正在播出:  %@", [dictionary objectForKey:@"programName"]];
    
    [NSString getStringOfWorth:[dictionary objectForKey:@"radioPlayCount"]];
    
       _downLabel.text = [NSString getStringOfWorth:[dictionary objectForKey:@"radioPlayCount"]];
    
  
    

    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
